#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution {
public:
    int findMaxConsecutiveOnes(vector<int>& nums) {
        int left = 0;
        int right = 0;
        int result =0;
        while(right<nums.size()){
            if(nums[right]==1){
                result = max(result,right-left+1);
            }
            else{
                left = right+1;
            }
            ++right;
        }
        return result;
    }
};

int main(){
    Solution S;
    vector<int> nums = {1,1,0,1,1,1};
    cout<<S.findMaxConsecutiveOnes(nums)<<endl;
}
